<link href="{{ asset('css/bootstrap.min.css') }}" rel="stylesheet">
<link href="{{ asset('css/font-awesome.min.css') }}" rel="stylesheet" />
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<script src="{{ asset('js/jquery-1.8.3.min.js') }}" type="text/javascript"></script>
<link rel="stylesheet" href="{{URL::asset('./css/register.css')}}">
<link rel="stylesheet" href="{{URL::asset('./css/reset.css')}}">
<!-- <a><img src="{{URL::asset('./img/index/floor_tel.png')}}" alt=""><p> -->
<meta name="_token" content="{{csrf_token()}}">
<style type="text/css">
    [v-cloak] {
        display: none !important;
    }
    .imgas {
        position: absolute;
        top: 0;
        left: 0;
        z-index: 1;
        width: 19.2rem;
        /* height: 100%; */
    }
    .loginForm {
        z-index: 2;
    }
    .login_box {
        display: flex;
        align-items: center;
    }

    .span {
        height: 50px;
        line-height: 20px;
        font-size: 16px;
        color: #000;
        border-left: 1px solid #e9e9e9;
        display: inline-block;
        margin-left: 15px;
        padding-left: 15px;
        padding-top: 5px;
        padding-bottom: 10px;
    }

    .img-box {
        height: 100%;
        width: 25px;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 999;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: #cccccc;
        border-radius: 2px 0 0 2px;
    }

    .img-box img {
        width: 18px;
        margin-left: -2px;
    }
    .userXy {
        width: 1200px;
        height: 80%;
        background: #fff;
        border-radius: 4px;
        position: fixed;
        top: 10%;
        left: 50%;
        margin-left: -600px;
        z-index: 999;
        padding: 20px;
        overflow-y: scroll;
    }
    .closeUser {
        float: right;
        cursor: pointer;
        font-size: 20px;
        color:#000;
    }
    .userCont {
        margin-top: 40px;
    }
</style>
<div id="login" v-cloak>
    <div class="login_header">
        <div class="login_headerDiv">
            <div class="login_box">
                <a href="{{route('home.index.index') }}">
                    <img :src="overall.site_logo">
                </a>
                <span class='span'>
                    新用户
                    <br>
                    注册
                </span>
            </div>
            <div class="login_headerTel">
                <span class="login_headerTel_tel">@{{overall.customer_mobile}}</span>
                <span class="login_headerTel_time">
                    服务时间：周一至周五9:00 - 18:00
                </span>
            </div>
        </div>
    </div>
    <div class="loginBg" :style="{height:height+'px'}">
        <img :src="overall.login_logo" :style="{height:height+'px'}" class="imgas" alt="">
        <div class="loginForm">
            <div class="loginMain">
                <div class="login_title">
                    <img :src="overall.site_logo">
                </div>
                <div class="login_nav">
                    <div :class='{active:activeBo==1}' @click="setActiveBo(1)">用户注册</div>
                    <div :class='{active:activeBo==2}' @click="setActiveBo(2)">供应商注册</div>
                </div>
                <!-- 用户基本注册 -->
                <div class="login_res">
                    <el-form v-show="activeBo==1 && next==1" :rules="rule1" :model="form" label-position="top" size="mini" ref="form">
                        <el-form-item prop="tel">
                            <div class="img-box">
                                <img src="{{URL::asset('./img/login/phone.png')}}">
                            </div>
                            <el-input v-model="form.tel" placeholder="手机号"></el-input>
                        </el-form-item>
                        <el-form-item prop="password">
                            <div class="img-box">
                                <img src="{{URL::asset('./img/login/password.png')}}">
                            </div>
                            <el-input v-model="form.password" placeholder="密码" show-password></el-input>
                        </el-form-item>
                        <el-form-item prop="verifyPass">
                            <div class="img-box">
                                <img src="{{URL::asset('./img/login/password.png')}}">
                            </div>
                            <el-input v-model="form.verifyPass" placeholder="确认密码" show-password></el-input>
                        </el-form-item>
                        <el-form-item prop="captcha" :rules="codeRule">
                            <span class="details_title">图形验证码：</span>
                            <el-input style="width:116px;padding-left:10px" v-model="form.captcha"></el-input>
                            <img class="codeImg" style="width:130px;height: 40px;margin:5px 0" @click="captchar" :src="captchaLink">
                            <p style="color: #888;font-size: 12px;"><i class="fa fa-question-circle-o"></i> 看不清，点击验证码换一张</p>
                        </el-form-item>
                        <el-form-item prop="code">
                            <div class="img-box">
                                <img src="{{URL::asset('./img/login/code.png')}}">
                            </div>
                            <el-input v-model="form.code" placeholder="验证码">
                                <span slot="suffix" @click="getCode" class="suffixCon">获取验证码<a v-if="codeBo">(@{{codeTime}}s)</a></span>
                            </el-input>
                        </el-form-item>
                    </el-form>
                </div>
                <!-- 用户详细信息注册 -->
                <el-form v-show="activeBo==1 && next==2" :rules="rule2" :model="form2" label-position="top" size="mini" ref="form2">
                    <el-form-item prop="name">
                        <el-input v-model="form2.name" placeholder="姓名"></el-input>
                    </el-form-item>
                    <el-form-item prop="sex">
                        <el-radio-group v-model="form2.sex" size="mini">
                            <el-radio label="1" border>男</el-radio>
                            <el-radio label="2" border>女</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item prop="email">
                        <el-input v-model="form2.email" placeholder="邮箱"></el-input>
                    </el-form-item>
                    <el-form-item prop="qq">
                        <el-input v-model="form2.qq" placeholder="qq号码"></el-input>
                    </el-form-item>
                    <el-form-item prop="companyName">
                        <el-input v-model="form2.companyName" placeholder="公司名称"></el-input>
                    </el-form-item>
                    <el-form-item prop="department">
                        <el-input v-model="form2.department" placeholder="部门"></el-input>
                    </el-form-item>
                    <el-form-item prop="post">
                        <el-input v-model="form2.post" placeholder="职位"></el-input>
                    </el-form-item>
                    <el-form-item prop="companyType">
                        <el-select v-model="form2.companyType" placeholder="公司类型" filterable clearable>
                            <el-option v-for="item in companyTypeData" :key="item.id" :label="item.name" :value="item.id">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item prop="companyIndustry">
                        <el-select v-model="form2.companyIndustry" placeholder="公司行业" filterable clearable>
                            <el-option v-for="item in companyIndustryData" :key="item.id" :label="item.name" :value="item.id">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item prop="companyEmployees">
                        <el-select v-model="form2.companyEmployees" placeholder="员工人数" filterable clearable>
                            <el-option v-for="item in companyEmployeesData" :key="item.id" :label="item.name" :value="item.id">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <!-- <el-form-item prop="HREmployees">
                        <el-select v-model="form2.HREmployees" placeholder="HR部门人数" filterable clearable>
                            <el-option v-for="item in HREmployeesData" :key="item.id" :label="item.name" :value="item.id">
                            </el-option>
                        </el-select>
                    </el-form-item> -->
                </el-form>
                <!-- 供应商注册 -->
                <div class="login_res">
                    <el-form v-show="activeBo==2 && next==1" :rules="rule3" :model="form3" label-position="top" size="mini" ref="form3">
                        <el-form-item prop="tel">
                            <div class="img-box">
                                <img src="{{URL::asset('./img/login/phone.png')}}">
                            </div>
                            <el-input v-model="form3.tel" placeholder="手机号"></el-input>
                        </el-form-item>
                        <el-form-item prop="password">
                            <div class="img-box">
                                <img src="{{URL::asset('./img/login/password.png')}}">
                            </div>
                            <el-input v-model="form3.password" placeholder="密码" show-password></el-input>
                        </el-form-item>
                        <el-form-item prop="verifyPass">
                            <div class="img-box">
                                <img src="{{URL::asset('./img/login/password.png')}}">
                            </div>
                            <el-input v-model="form3.verifyPass" placeholder="确认密码" show-password></el-input>
                        </el-form-item>
                        <el-form-item prop="captcha" :rules="codeRule">
                            <span class="details_title">图形验证码：</span>
                            <el-input style="width:116px;padding-left:10px" v-model="form3.captcha"></el-input>
                            <img class="codeImg" style="width:130px;height: 40px;margin:5px 0" @click="captchar" :src="captchaLink">
                            <p style="color: #888;font-size: 12px;"><i class="fa fa-question-circle-o"></i> 看不清，点击验证码换一张</p>
                        </el-form-item>
                        <el-form-item prop="code">
                            <div class="img-box">
                                <img src="{{URL::asset('./img/login/code.png')}}">
                            </div>
                            <el-input v-model="form3.code" placeholder="验证码">
                                <span slot="suffix" @click="getCode" class="suffixCon">获取验证码<a v-if="codeBo">(@{{codeTime}}s)</a></span>
                            </el-input>
                        </el-form-item>
                        <!-- <el-form-item  prop="fileList">
                        <div style="width:3rem; ">
                            <el-upload class="upload-demo" drag :on-remove="handleRemove" :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload" :action="uploadUrl" multiple>
                                <i class="el-icon-upload"></i>
                                <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
                                <div class="el-upload__tip" slot="tip">认证资料（只能上传pdf/word件）</div>
                            </el-upload>
                        </div>
                    </el-form-item> -->
                    </el-form>
                </div>
                <!-- 供应商详细信息注册 -->
                <el-form v-show="activeBo==2 && next==2" :rules="rule4" :model="form4" label-position="top" size="mini" ref="form4">
                    <el-form-item prop="companyName">
                        <el-input v-model="form4.companyName" placeholder="公司名称"></el-input>
                    </el-form-item>
                    <el-form-item prop="companyEmail">
                        <el-input v-model="form4.companyEmail" placeholder="公司邮箱"></el-input>
                    </el-form-item>
                    <el-form-item prop="companyTel">
                        <el-input v-model="form4.companyTel" placeholder="公司电话"></el-input>
                    </el-form-item>
                    <el-form-item prop="name">
                        <el-input v-model="form4.name" placeholder="负责人姓名"></el-input>
                    </el-form-item>
                    <el-form-item prop="usertel">
                        <el-input v-model="form4.usertel" placeholder="负责人电话"></el-input>
                    </el-form-item>
                    <el-form-item prop="post">
                        <el-input v-model="form4.post" placeholder="负责人职位"></el-input>
                    </el-form-item>
                    <el-form-item prop="companyType">
                        <el-select v-model="form4.companyType" placeholder="公司类型" filterable clearable>
                            <el-option v-for="item in companyTypeData" :key="item.id" :label="item.name" :value="item.id">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item prop="companyIndustry">
                        <el-select v-model="form4.companyIndustry" placeholder="公司行业" filterable clearable>
                            <el-option v-for="item in companyIndustryData" :key="item.id" :label="item.name" :value="item.id">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item prop="companyEmployees">
                        <el-select v-model="form4.companyEmployees" placeholder="员工人数" filterable clearable>
                            <el-option v-for="item in companyEmployeesData" :key="item.id" :label="item.name" :value="item.id">
                            </el-option>
                        </el-select>
                    </el-form-item>
                </el-form>
                <!-- 阅读服务条款 -->
                <div class="remenberPass" v-if=" next==1" @click="remenberPass">
                    <span :class="{active:remenberBo}">
                        <img src="{{URL::asset('./img/login/remenber.png')}}" v-if="remenberBo">
                    </span><a>我已阅读并同意《<span @click.stop="showUser">用户服务协议</span>》服务条款</a>
                </div>
                <!-- 提交下一步 -->
                <el-button v-if="next==1" :disable="remenberBo" class="submit" :loading="submitBo" @click="submitForm(activeBo==1?'form':'form3')">
                    下一步
                </el-button>
                <!-- 确认注册 -->
                <el-button v-else class="submit" :loading="submitBo" @click="submitForm(activeBo==1?'form2':'form4')">
                    @{{activeBo==1?'确认注册':'提交注册审核'}}
                </el-button>
            </div>
            <div class="forgetRegister" v-if="next==1">
                <div>
                    已有账号？
                    &nbsp;&nbsp;<a target="_blank" href="{{ route('home.login.login') }}">
                        立即登录
                    </a>
                </div>
            </div>
        </div>
    </div>
    <div class="login_footer">
    <div class="login_footer_first">
            <a href="{{route('home.index.index') }}">
                首页 
            </a>
            <span>|</span>
            <a href="{{route('home.store.storeList') }}">
                供应商
            </a>
            <span>|</span>
            <a href="{{route('home.activity.actCate') }}">
                活动/会议/培训
            </a>
            <span>|</span>
            <a href="{{route('home.goods.goodsCate') }}">
                商品
            </a>
            <span>|</span>
            <a href="{{route('home.word.wordCate') }}">
                文档下载
            </a>
            <span>|</span>
            <a href="{{route('home.demand.demandList') }}">
                需求市场
            </a>
            <span>|</span>
            <a href="{{route('home.news.news') }}">
                新闻资讯
            </a>
        </div>
        <div class="login_footer_two">
            <a>
                <img src="{{URL::asset('./img/1.png')}}">
            </a>
            <a>
                <img src="{{URL::asset('./img/2.png')}}">
            </a>
            <!-- <a>
                <img src="{{URL::asset('./img/3.png')}}">
            </a> -->
            <a>
                <img src="{{URL::asset('./img/4.png')}}">
            </a>
            <a>
                <img src="{{URL::asset('./img/5.png')}}">
            </a>
            <!-- <a>
                <img src="{{URL::asset('./img/6.png')}}">
            </a> -->
        </div>
        <div class="login_footer_three">
            <a href="http://www.miit.gov.cn/" target="_blank">Copyright 2019-2022 www.hrqidian.com 重庆启群大数据科技有限公司版权所有 备案：渝ICP备19010042号-1</a>
        </div>
    </div>
    {{--用户协议--}}
    <div class="userXy" v-show="showXy">
        <p class="closeUser" @click="closeXy">X</p>
        <div class="userCont" v-html="userCont">@{{userCont}}}}</div>
    </div>
</div>

<script src="{{ asset('js/vue.min.js') }}" type="text/javascript"></script>
<script src="{{ asset('js/element.js') }}" type="text/javascript"></script>
<script src="{{ asset('js/moment.min.js') }}" type="text/javascript"></script>
<script src="{{ asset('js/bootstrap.min.js') }}" type="text/javascript"></script>
<script src="{{ asset('js/public.js') }}" type="text/javascript"></script>
<script>
    $(() => {
        let app = new Vue({
            el: '#login',
            data() {
                var validateTel = (rule, value, callback) => {
                    var reg = /^((13|14|15|16|17|18|19)[0-9]\d{8})$/;
                    if (value == '') {
                        callback(new Error('请输入联系电话'));
                    } else if (!reg.test(value)) {
                        callback(new Error('请输入正确的联系电话!'));
                    } else {
                        callback();
                    }
                };
                var validatePass2 = (rule, value, callback) => {
                    if (value == '') {
                        callback(new Error('请再次输入密码'));
                    } else if (value != this.form.password) {
                        callback(new Error('两次输入密码不一致!'));
                    } else {
                        callback();
                    }
                };
                var validatePass3 = (rule, value, callback) => {
                    if (value == '') {
                        callback(new Error('请再次输入密码'));
                    } else if (value != this.form3.password) {
                        callback(new Error('两次输入密码不一致!'));
                    } else {
                        callback();
                    }
                };
                return {
                    height:'',
                    userCont:'加载中',
                    showXy: false,
                    captchaLink: '',
                    overall: "",
                    activeBo: 1,
                    uploadUrl: UPLOAD_FILE,
                    stepOne: 0,
                    form: {
                        tel: "",
                        password: '',
                        verifyPass: '',
                        code: '',
                        captcha: ''
                    },
                    form2: {
                        name: '',
                        sex: '1',
                        email: '',
                        companyName: '',
                        department: '',
                        post: '',
                        companyType: '',
                        companyIndustry: '',
                        companyEmployees: '',
                        // HREmployees: '',
                        qq: ''
                    },
                    form3: {
                        tel: "",
                        password: '',
                        verifyPass: '',
                        code: '',
                        fileList: [],
                        captcha: ''
                    },

                    form4: {
                        companyName: '',
                        companyEmail: '',
                        companyTel: '',
                        name: '',
                        usertel: '',
                        post: '',
                        companyType: '',
                        companyIndustry: '',
                        companyEmployees: '',
                    },
                    next: 1,
                    codeRule: [{
                        required: true,
                        message: '图形验证码不能为空',
                        trigger: 'blur'
                    }],
                    rule1: {
                        codeRule: [{
                            required: true,
                            message: '图形验证码不能为空',
                            trigger: 'blur'
                        }],
                        tel: [{
                            required: true,
                            validator: validateTel,
                            trigger: 'blur'
                        }],
                        password: [{
                            required: true,
                            message: '密码不能为空',
                            trigger: 'blur'
                        }],
                        verifyPass: [{
                            required: true,
                            validator: validatePass2,
                            trigger: 'blur'
                        }],
                        code: [{
                            required: true,
                            message: '验证码不能为空',
                            trigger: 'blur'
                        }],
                    },
                    rule2: {
                        codeRule: [{
                            required: true,
                            message: '图形验证码不能为空',
                            trigger: 'blur'
                        }],
                        name: [{
                            required: true,
                            message: '姓名不能为空',
                            trigger: 'blur'
                        }],
                        sex: [{
                            required: true,
                            message: '请选择性别',
                            trigger: 'blur'
                        }],
                        email: [{
                            required: true,
                            validator: validateEmail,
                            trigger: 'blur'
                        }],
                        companyName: [{
                            required: true,
                            message: '公司名称不能为空',
                            trigger: 'blur'
                        }],
                        department: [{
                            required: true,
                            message: '部门不能为空',
                            trigger: 'blur'
                        }],
                        post: [{
                            required: true,
                            message: '职位不能为空',
                            trigger: 'blur'
                        }],
                        companyType: {
                            required: true,
                            message: '公司类型不能为空',
                            trigger: 'change'
                        },
                        companyIndustry: {
                            required: true,
                            message: '公司行业不能为空',
                            trigger: 'change'
                        },
                        companyEmployees: {
                            required: true,
                            message: '员工人数不能为空',
                            trigger: 'change'
                        },
                        HREmployees: {
                            required: true,
                            message: 'HR部门人数不能为空',
                            trigger: 'change'
                        },
                    },
                    rule3: {
                        codeRule: [{
                            required: true,
                            message: '图形验证码不能为空',
                            trigger: 'blur'
                        }],
                        tel: {
                            required: true,
                            validator: validateTel,
                            trigger: 'blur'
                        },
                        password: [{
                            required: true,
                            message: '密码不能为空',
                            trigger: 'blur'
                        }],
                        verifyPass: [{
                            required: true,
                            validator: validatePass3,
                            trigger: 'blur'
                        }],
                        code: [{
                            required: true,
                            message: '验证码不能为空',
                            trigger: 'blur'
                        }],
                        fileList: [{
                            required: true,
                            message: '请选择文件',
                            trigger: 'blur'
                        }],
                    },
                    rule4: {
                        companyName: [{
                            required: true,
                            message: '公司名称不能为空',
                            trigger: 'blur'
                        }],
                        companyEmail: [{
                            required: true,
                            validator: validateEmail,
                            trigger: 'blur'
                        }],
                        companyTel: [{
                            required: true,
                            message: '公司电话不能为空',
                            trigger: 'blur'
                        }],
                        name: [{
                            required: true,
                            message: '负责人姓名不能为空',
                            trigger: 'blur'
                        }],
                        usertel: {
                            required: true,
                            validator: validateTel,
                            trigger: 'blur'
                        },
                        post: [{
                            required: true,
                            message: '负责人职位不能为空',
                            trigger: 'blur'
                        }],
                        codeRule: [{
                            required: true,
                            message: '图形验证码不能为空',
                            trigger: 'blur'
                        }],
                        companyType: {
                            required: true,
                            message: '公司类型不能为空',
                            trigger: 'change'
                        },
                        companyIndustry: {
                            required: true,
                            message: '公司行业不能为空',
                            trigger: 'change'
                        },
                        companyEmployees: {
                            required: true,
                            message: '员工人数不能为空',
                            trigger: 'change'
                        },
                    },
                    remenberBo: false,
                    codeTime: 60,
                    submitBo: false,
                    codeBo: false,
                    companyTypeData: [],
                    companyIndustryData: [],
                    companyEmployeesData: [],
                    HREmployeesData: [],

                }
            },
            created() {
                window.$message = (res) => {
                    this.$message({
                        message: res,
                        type: 'error'
                    });
                }
                $.get("{{ route('home.public.config') }}", (res) => {
                    sessionStorage.setItem("overall", JSON.stringify(res.data))
                    this.overall = res.data
                    this.userCont = res.data.register_agreement
                });
                //公司类型
                apiAjax("{{ route('home.public.companys') }}", 'get', {
                    type: 1
                }, (res) => {
                    this.companyTypeData = res.data;
                });
                //公司行业
                apiAjax("{{ route('home.public.companys') }}", 'get', {
                    type: 2
                }, (res) => {
                    this.companyIndustryData = res.data;
                });
                //公司规模（员工人数）
                apiAjax("{{ route('home.public.companys') }}", 'get', {
                    type: 3
                }, (res) => {
                    this.companyEmployeesData = res.data;
                });
                //HR部门人数
                apiAjax("{{ route('home.public.companys') }}", 'get', {
                    type: 4
                }, (res) => {
                    this.HREmployeesData = res.data;
                });
                this.captchar()
            },
            mounted() {
                this.height = document.body.clientHeight - 107 - 190
            },
            methods: {
                showUser(){
                    this.showXy = true;
                },
                closeXy(){
                    this.showXy = false;
                },
                //图形验证码
                captchar() {
                    let that = this;
                    $.get("{{ route('admin.auth.captcha') }}", function(res) {
                        that.captchaLink = res.data;
                    }, 'JSON ');
                },
                setActiveBo(num) {
                    if (this.submitBo) {} else {
                        this.activeBo = num;
                        this.stepOne = 0;
                        this.next = 1;
                        this.$nextTick(() => {
                            if (this.$refs['form']) {
                                this.$refs['form'].resetFields();
                            }
                            if (this.$refs['form3']) {
                                this.$refs['form3'].resetFields();
                            }
                            if (this.$refs['form2']) {
                                this.form2.sex = '1'
                                this.$refs['form2'].resetFields();
                            }
                            if (this.$refs['form4']) {
                                this.$refs['form4'].resetFields();
                            }
                        })
                    }
                },
                remenberPass() {
                    this.remenberBo = !this.remenberBo;
                },
                getCode() {
                    if (this.codeTime == 60) {
                        let captcha = this.activeBo == 1 ? this.form.captcha : this.form3.captcha 
                        let tel = this.activeBo == 1 ? this.form.tel : this.form3.tel 
                        if (!tel) return this.$message({
                            message: '请输入您的手机号码！',
                            type: 'warning'
                        });
                        let reg = /^((13|14|15|16|17|18|19)[0-9]\d{8})$/
                        if (!reg.test(tel)) return this.$message({
                            message: '请输入正确的联系电话！',
                            type: 'warning'
                        });
                        apiAjax("{{ route('home.phone.getSMS') }}", 'post', {
                            captcha: captcha,
                            phone: tel
                        }, (res) => {
                            if (res.code == 0) {
                                this.$message({
                                    message: "验证码已发送至您的手机",
                                    type: 'success'
                                });
                            } else {
                                this.$message({
                                    message: res.msg,
                                    type: 'warning'
                                });
                            }

                        });
                    }
                },
                submitForm(formName) {
                    this.$refs[formName].validate((valid) => {
                        if (valid) {
                            if (this.remenberBo) {
                                this.submitBo = true;
                                //用户注册
                                if (this.activeBo == 1) {
                                    // 第一步
                                    if (this.next == 1) {
                                        let data = {
                                            mobile: this.form.tel,
                                            password: this.form.password,
                                            confirmc_pass: this.form.verifyPass,
                                            code: this.form.code,
                                        }
                                        apiAjax("{{ route('home.register.hrStep1') }}", 'post', data, (res) => {
                                            this.submitBo = false;
                                            if (res.code == 0) {
                                                this.next = 2;
                                                this.stepOne = res.data;
                                                // window.location.href = "{{ route('home.register.registerGuide') }}";
                                            } else {
                                                this.$message({
                                                    message: res.msg,
                                                    type: 'warning'
                                                });
                                            }
                                        }, (erro) => {
                                            this.submitBo = false;
                                        })
                                        // 第二步
                                    } else if (this.next == 2) {
                                        let data = {
                                            tid: this.stepOne,
                                            username: this.form2.name,
                                            email: this.form2.email,
                                            sex: this.form2.sex,
                                            company_name: this.form2.companyName,
                                            hr_department: this.form2.department,
                                            hr_position: this.form2.post,
                                            company_type: this.form2.companyType,
                                            company_industry: this.form2.companyIndustry,
                                            company_size: this.form2.companyEmployees,
                                            qq: this.form2.qq
                                            // hr_size: this.form2.HREmployees,
                                        }
                                        apiAjax("{{ route('home.register.hrStep2') }}", 'post', data, (res) => {
                                            this.submitBo = false;
                                            if (res.code == 0) {
                                                // this.next = 2;
                                                apiAjax("{{ route('home.login.login') }}", 'post', {
                                                    mobile: this.form.tel,
                                                    password: this.form.password,
                                                    user_type: 1,
                                                }, (res) => {
                                                    if (res.code == 0) {
                                                        if (this.remenberBo) {
                                                            setCookie('HRTel', this.form.tel);
                                                            setCookie('HRPassword', this.form.password);
                                                        } else {
                                                            delCookie('HRTel')
                                                            delCookie('HRPassword')
                                                        }
                                                        sessionStorage.setItem("HRuserDetails", JSON.stringify(res.data))
                                                        window.location.href = "{{ route('home.register.hrRegisterGuide') }}";
                                                    } else {
                                                        this.$message({
                                                            message: res.msg,
                                                            type: 'warning'
                                                        });
                                                    }
                                                    this.submitBo = false;
                                                }, (erro) => {
                                                    this.submitBo = false;
                                                });
                                            } else {
                                                this.$message({
                                                    message: res.msg,
                                                    type: 'warning'
                                                });
                                            }
                                        }, (erro) => {
                                            this.submitBo = false;

                                        })
                                    }
                                    //供应商注册
                                } else if (this.activeBo == 2) {
                                    //第一步
                                    if (this.next == 1) {
                                        let data = {
                                            mobile: this.form3.tel,
                                            password: this.form3.password,
                                            confirmc_pass: this.form3.verifyPass,
                                            code: this.form3.code,
                                            // certification: this.form3.fileList,
                                        }
                                        apiAjax("{{ route('home.register.supplierRegister') }}", 'post', data, (res) => {
                                            this.submitBo = false;
                                            if (res.code == 0) {
                                                // this.next = 2;
                                                // this.stepOne = res.data;
                                                apiAjax("{{ route('home.login.login') }}", 'post', {
                                                    mobile: this.form3.tel,
                                                    password: this.form3.password,
                                                    user_type: 1,
                                                }, (res) => {
                                                    if (res.code == 0) {
                                                        if (this.remenberBo) {
                                                            setCookie('HRTel', this.form.tel);
                                                            setCookie('HRPassword', this.form.password);
                                                        } else {
                                                            delCookie('HRTel')
                                                            delCookie('HRPassword')
                                                        }
                                                        sessionStorage.setItem("HRuserDetails", JSON.stringify(res.data))
                                                        window.location.href = "{{ route('home.register.registerGuide') }}";
                                                    } else {
                                                        this.$message({
                                                            message: res.msg,
                                                            type: 'warning'
                                                        });
                                                    }
                                                    this.submitBo = false;
                                                }, (erro) => {
                                                    this.submitBo = false;
                                                });
                                            } else {
                                                this.$message({
                                                    message: res.msg,
                                                    type: 'warning'
                                                });
                                            }
                                        }, (erro) => {
                                            this.submitBo = false;
                                        })
                                        //第二步
                                    }
                                }

                            } else {
                                this.$message({
                                    message: '请阅读用户协议',
                                    type: 'warning'
                                });
                            }

                        } else {
                            return false;
                        }
                    });


                },


                beforeAvatarUpload(file) {
                    const type = file.name.split('.')[1];
                    const isJPG = type == 'doc' || type == 'docx' || type == 'pdf';
                    // const isJPG = file.type == 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' ||
                    //     file.type == 'pdf';

                    if (!isJPG) {
                        this.$message.error('上传文件只能是PDF和word!');
                    }
                    return isJPG;
                },
                handleAvatarSuccess(res, file) {
                    this.form3.fileList.push(res.data.path)
                },
                handleRemove(file, fileList) {
                    this.form3.fileList = [];
                    fileList.forEach(element => {
                        this.form3.fileList.push(element.response.data.path)
                    });
                },
            }

        })
    })
</script>